package com.example.howard.xiao7music.ui.adapter.LocalAdapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.howard.xiao7music.R;

import java.util.List;
import java.util.Map;

/**
 * Created by Howard on 2016/10/25.
 */
public class LocalSingerAdapter extends BaseAdapter {
    LayoutInflater inflater;
    List<String> list;


    public LocalSingerAdapter (Context c, List<String> singerlist){
        this.inflater = LayoutInflater.from(c);
        this.list=singerlist;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    public View getView(final int position, View convertView,
                        ViewGroup parent) {
        ViewHolder viewHolder;

        if (convertView == null) {
            convertView = inflater.inflate(R.layout.local_singer_item, null);
            viewHolder = new ViewHolder();
            viewHolder.singer_name = (TextView) convertView
                    .findViewById(R.id.singer_info_name);

            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        viewHolder.singer_name.setText(list.get(position));

        return convertView;
    }

    class ViewHolder {
        TextView singer_name;
    }
}
